package com.example.check_oa.controller;

import com.example.comment_oa.pojos.attendance.BusinessTripAp;
import com.example.check_oa.model.service.BusinessTripApService;
import com.example.comment_oa.response.AjaxResponse;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import java.util.Map;

@RestController
@RequestMapping("checkOa/trip")
@CrossOrigin
public class TrevelController {
    @Resource
    BusinessTripApService businessTripApService;

    @PostMapping("/query/{day}/{userNo}/{type}")
    public AjaxResponse query(@PathVariable("day") String day,@PathVariable("userNo") String userNo,@PathVariable("type")int type){
        Map all = businessTripApService.all(day, userNo,type);
        return AjaxResponse.success(all);
    }

    @PostMapping("add")
    public AjaxResponse add(BusinessTripAp businessTripAp, MultipartFile file){
        return AjaxResponse.success(businessTripApService.add(businessTripAp,file));
    }
}
